package com.xpalive.pojo;

import com.xpalive.config.Property;

import java.util.List;

/**
 * Created by xiongping on 2017/5/21.
 */
public class DocAttr {

    private String fromUrl;
    private String fromUrlText;
    private String requestUrl;
    private String location;
    private List<UrlAttr> imageUrls;
    private List<UrlAttr> docUrls;

    public String getFromUrl() {
        return fromUrl;
    }

    public void setFromUrl(String fromUrl) {
        this.fromUrl = fromUrl;
    }

    public String getFromUrlText() {
        return fromUrlText;
    }

    public void setFromUrlText(String fromUrlText) {
        this.fromUrlText = fromUrlText;
    }

    public String getRequestUrl() {
        return requestUrl;
    }

    public void setRequestUrl(String requestUrl) {
        this.requestUrl = requestUrl;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public List<UrlAttr> getImageUrls() {
        return imageUrls;
    }

    public void setImageUrls(List<UrlAttr> imageUrls) {
        this.imageUrls = imageUrls;
    }

    public List<UrlAttr> getDocUrls() {
        return docUrls;
    }

    public void setDocUrls(List<UrlAttr> docUrls) {
        this.docUrls = docUrls;
    }

    public boolean isNotFoundPage() {
        return Property.getNotFoundPageUrl().equals(this.getLocation());
    }

    public boolean isErrorPage(String bodyHtml) {
        List<String> keyWordList = Property.getKeyWordList();
        for (String s : keyWordList) {
            if(bodyHtml.contains(s)){
                return true;
            }
        }
        return false;
    }
}
